#pragma once
#include "TaskItGUI.h"

namespace UI {

	using namespace System;
	using namespace System::ComponentModel;
	using namespace System::Collections;
	using namespace System::Windows::Forms;
	using namespace System::Data;
	using namespace System::Drawing;

	/// <summary>
	/// Summary for TaskItLogin
	/// </summary>
	public ref class TaskItLogin : public System::Windows::Forms::Form
	{
	private: String^ _username;
	public:
		TaskItLogin(void)
		{
			InitializeComponent();
			//
			//TODO: Add the constructor code here
			//
		}

	protected:
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		~TaskItLogin()
		{
			if (components)
			{
				delete components;
			}
		}
	private: System::Windows::Forms::TextBox^  nameBox;
	private: System::Windows::Forms::Label^  label1;
	protected:

	protected:

	private:
		/// <summary>
		/// Required designer variable.
		/// </summary>
		System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		void InitializeComponent(void)
		{
			this->nameBox = (gcnew System::Windows::Forms::TextBox());
			this->label1 = (gcnew System::Windows::Forms::Label());
			this->SuspendLayout();
			// 
			// nameBox
			// 
			this->nameBox->Location = System::Drawing::Point(33, 195);
			this->nameBox->Name = L"nameBox";
			this->nameBox->Size = System::Drawing::Size(204, 20);
			this->nameBox->TabIndex = 0;
			this->nameBox->Text = L"Pls enter your name";
			this->nameBox->KeyDown += gcnew System::Windows::Forms::KeyEventHandler(this, &TaskItLogin::nameBox_KeyDown);
			// 
			// label1
			// 
			this->label1->AutoSize = true;
			this->label1->Font = (gcnew System::Drawing::Font(L"Times New Roman", 15.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
				static_cast<System::Byte>(0)));
			this->label1->Location = System::Drawing::Point(47, 83);
			this->label1->Name = L"label1";
			this->label1->Size = System::Drawing::Size(175, 24);
			this->label1->TabIndex = 1;
			this->label1->Text = L"Welcome to TaskIt";
			// 
			// TaskItLogin
			// 
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
			this->ClientSize = System::Drawing::Size(284, 262);
			this->Controls->Add(this->label1);
			this->Controls->Add(this->nameBox);
			this->Name = L"TaskItLogin";
			this->Text = L"TaskItLogin";
			this->ResumeLayout(false);
			this->PerformLayout();

		}
#pragma endregion


	private: System::Void nameBox_KeyDown(System::Object^  sender, System::Windows::Forms::KeyEventArgs^  e) {

				 if (e->KeyCode == Keys::Enter){
					 _username = nameBox->Text;
					 TaskItGUI^ mainWindow = gcnew TaskItGUI(getUsername());
					 mainWindow->Show();
					 this->Hide();
					 //Application::Exit();
				 }

	}
	public: String^ getUsername(){
				return _username;
	}


	};
}